<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="layui/css/layui.css">
<script src="src/layuiadmin/js/jquery-1.8.2.js"></script>
<script src="layui/layui.js"></script>
</head>
<body>
	<div class="layui-carousel" id="test1" lay-filter="test1">
		<div carousel-item="" id = "lbt">
			
			
		</div>
	</div>

	<script>
	layui.use('carousel', function(){
		  var carousel = layui.carousel;
		  
		  //建造实例
		  var ins = carousel.render({
		    elem: '#test1'
		    ,width: '100%' //设置容器宽度
		    ,arrow: 'always' //始终显示箭头
		    //,anim: 'updown' //切换动画方式
		  });
		  
		  $.ajax({
				url : "/yaxiya/xianshitupian",//地址
				type : "get",//请求方式

				success : function(res) {//成功以后的回调函数
					var list = res.data;
					for (var i = 0; i < list.length; i++)
						$("#lbt").append(
								"<div><img src='/wangwang/"+list[i].tupian+"'></div>");

					//重置轮播
					ins.reload({
					    elem: '#test1'
						    ,width: '100%' //设置容器宽度
						    ,arrow: 'always' //始终显示箭头
						    //,anim: 'updown' //切换动画方式
						  });
				}

			});
		  
		  
		 
		});
	</script>
</body>
</html>